package com.Web;


import java.io.IOException;
import java.util.List;




import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;





import com.entity.Employee;
import com.entity.Project;




import com.service.ProjectService;



public class mainServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;
	
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		HttpSession session = request.getSession();
		Employee em = (Employee) session.getAttribute("em");
		 
		ProjectService service = new ProjectService();
         List<Project> list = service.login(em.getId());
        
 		for (int i = 0; i < list.size(); i++) {
 			Project r = list.get(i);
 			session.setAttribute("r", r.getId());
 		}	
        
         session.setAttribute("list", list);
         session.setAttribute("e",em.getUsername());
        request.getRequestDispatcher("/WEB-INF/views/login.jsp").forward(request, response);
		
    }

}
